<template>
  <view class="webview-container">
    <web-view :src="url"></web-view>
  </view>
</template>

<script setup language="ts">
import { ref } from 'vue'
import { onLoad } from '@dcloudio/uni-app'

const url = ref('')

// 页面加载时获取传入的 url 参数
onLoad((options) => {
  if (options.url) {
    url.value = decodeURIComponent(options.url)
  } else {
    uni.showToast({ title: '网址无效', icon: 'none' })
    uni.navigateBack()
  }
})
</script>

<style>
.webview-container {
  width: 100%;
  height: 100%;
}
</style>
